{include file="public/nheader"}
<div class="layui-fluid layui-bg-white">
    <form action="{:url()}" class="layui-form layui-form-fixed">
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>品牌名称
            </label>
            <div class="layui-input-block">
                <input type="text" id="pinpai" name="pinpai" value="{$row.pinpai|default=''}" required=""
                    lay-verify="required" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-form-item" id="eclaiyuan">
            <label class="layui-form-label">
                <font color="red">* </font>是否开启
            </label>
            <div class="layui-input-block">
                <select name="kags" lay-verify="">
                    <option value="1" {if !empty($row['kags']) && $row['kags']==1}selected{/if}>
                        开启
                    </option>
                    <option value="2" {if !empty($row['kags']) && $row['kags']==2}selected{/if}>
                        关闭
                    </option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>屏蔽品牌
            </label>
            <div class="layui-input-block">
                {if !empty($pinpai) && count($pinpai) > 0}
                {foreach $pinpai as $list}
                <input type="checkbox" name="pbpp[]" value="{$list.type}" title="{$list.pinpai}" {if
                    !empty($row['pbpp']) && is_array($row['pbpp']) && count($row['pbpp'])> 0 &&
                in_array($list.type,$row['pbpp'])}checked{/if}>
                {/foreach}
                {else}
                无
                {/if}
                <div style="color: red;">同cid尽量设置屏蔽,为防止不同品牌同cid数据互串(同cid类目不同不会互串,但设置可以避免修改类目后数据互串)，请选择屏蔽的品牌</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>跑动省份(开发中)
            </label>
            <div class="layui-input-block">
                {if !empty($provincelist) && count($provincelist) > 0}
                {foreach $provincelist as $list}
                <input type="checkbox" name="provincelist[]" value="{$list}" title="{$list}" {if
                    !empty($row['provincelist']) && is_array($row['provincelist']) && count($row['provincelist'])> 0 &&
                in_array($list,$row['provincelist'])}checked{/if}>
                {/foreach}
                {else}
                无
                {/if}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>日有效数量
            </label>
            <div class="layui-input-block">
                <input type="number" id="youxiao" name="youxiao" value="{$row.youxiao|default='0'}" required=""
                    lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>日无效数量
            </label>
            <div class="layui-input-block">
                <input type="number" id="wuxiao" name="wuxiao" value="{$row.wuxiao|default='0'}" required=""
                    lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>每条间隔时间
            </label>
            <div class="layui-input-block">
                <input type="number" id="times" name="times" value="{$row.times|default='1'}" required=""
                    lay-verify="required" autocomplete="off" class="layui-input">
            </div>
            <div style="color:red">单位:分钟,修改间隔时间必须等上一条跑完才会重新生效</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>导入日期
            </label>
            <div class="layui-input-block">
                <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
                    style="width: 150px;display: inline-block;" id="daterangestar" name="daterangestar"
                    value="{$row.daterangestar|default=''}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">日至
                <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
                    style="width: 150px;display: inline-block;" id="daterangeend" name="daterangeend"
                    value="{$row.daterangeend|default=''}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">日
                <div style="color:red">含起始日期当天，不含结束日期当天。如果起始日期和结束日期均低于运行日期品牌自动导入功能自动关闭</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>日导入时间点
            </label>
            <div class="layui-input-block">
                <input type="number" style="width: 150px;display: inline-block;" id="startime" name="startime"
                    value="{$row.startime|default='9'}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">点至
                <input type="number" style="width: 150px;display: inline-block;" id="endtime" name="endtime"
                    value="{$row.endtime|default='22'}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">点
                <div style="color:red">1-24点,起始时间必须小于结束时间，每天最多导入的条数=(结束时间-开始时间)*60/(每条间隔时间)</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <font color="red">* </font>资源日期范围
            </label>
            <div class="layui-input-block">
                <input type="number" style="width: 150px;display: inline-block;" id="datebefore" name="datebefore"
                    value="{$row.datebefore|default='0'}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">至
                <input type="number" style="width: 150px;display: inline-block;" id="dateafter" name="dateafter"
                    value="{$row.dateafter|default='0'}" required="" lay-verify="required" autocomplete="off"
                    class="layui-input">天前
                <div style="color:red">如果存在一个数据是0，默认使用系统配置内数据</div>
            </div>
        </div>
        <div class="layui-footer layui-form-item layui-center ">
            <input type="hidden" value="{$row.id|default='0'}" name="id" />
            <button class="layui-btn" lay-filter="submitIframe" type="button" lay-submit>提交</button>
            <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">取消</button>
        </div>
    </form>
</div>
{include file="public/nfooter"}
<script>
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
            , layer = layui.layer;
        form.on('switch(kags)', function (data) {
            var value = data.value;
            console.log(value, data);
            return false;
        });
        form.on('checkbox(father)', function (data) {
            if (data.elem.checked) {
                $(data.elem).parent().next('div').find('input').prop("checked", true);
                form.render();
            } else {
                $(data.elem).parent().next('div').find('input').prop("checked", false);
                form.render();
            }
        });
    });
</script>